<?php
class AdMondel extends MongoModel{
	var $table ='ad';
	var $name = '广告';
	
	public static function getName($id){
		$ad = AdMondel::model()->get_by_attrs(array(
			'site_id' 	=> SITE_ID,
			'_id' 		=> $id
		), 'title');
		if(empty($ad)){
			return '';
		}else{
			return $ad['title'];
		}
	}
	
	public static function getNameByCode($code){
		$ad = AdMondel::model()->get_by_attrs(array(
			'site_id' 	=> SITE_ID,
			'code' 		=> $code
		), 'title');
		if(empty($ad)){
			return '';
		}else{
			return $ad['title'];
		}
	}
}

?>